cmake_minimum_required(VERSION 3.5)
project(hello_drogon)

set(CMAKE_CXX_STANDARD 14)


#Jsoncpp
SET(JSONCPP_DIRS D:/c++lib/jsoncpp1.9.4)

include_directories(${JSONCPP_DIRS}/include)
link_directories(${JSONCPP_DIRS}/lib)
link_libraries(libjsoncpp.dll.a)

#zlib
SET(ZLIB_DIR D:/c++lib/zlib)
include_directories(${ZLIB_DIR}/include)
link_directories(${ZLIB_DIR}/lib)
link_libraries(libzlib.dll.a)

set(C_FLAGS -Wno-unused-parameter)

#boost
SET(BOOST_DIR D:/boost1.71.0)
include_directories(${BOOST_DIR}/include/boost-1_71)

#drogon
SET(DROGON_DIR D:/c++lib/drogon1.7.1)
include_directories(${DROGON_DIR}/include)
link_directories(${DROGON_DIR}/lib)
link_libraries(libdrogon.dll.a libtrantor.dll.a)



if (HAS_ANY AND HAS_STRING_VIEW AND HAS_COROUTINE)
    set(CMAKE_CXX_STANDARD 20)
elseif (HAS_ANY AND HAS_STRING_VIEW)
    set(CMAKE_CXX_STANDARD 17)
else ()
    set(CMAKE_CXX_STANDARD 14)
endif ()

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

add_executable(${PROJECT_NAME} main.cc)


if (CMAKE_CXX_STANDARD LESS 17)
    # With C++14, use boost to support any and string_view
    message(STATUS "use c++14")
    find_package(Boost 1.61.0 REQUIRED)
    target_include_directories(${PROJECT_NAME} PRIVATE ${Boost_INCLUDE_DIRS})
elseif (CMAKE_CXX_STANDARD LESS 20)
    message(STATUS "use c++17")
else ()
    message(STATUS "use c++20")
endif ()

aux_source_directory(controllers CTL_SRC)
aux_source_directory(filters FILTER_SRC)
aux_source_directory(plugins PLUGIN_SRC)
aux_source_directory(models MODEL_SRC)


target_include_directories(${PROJECT_NAME}
        PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}/models)
target_sources(${PROJECT_NAME}
        PRIVATE
        ${SRC_DIR}
        ${CTL_SRC}
        ${FILTER_SRC}
        ${PLUGIN_SRC}
        ${MODEL_SRC})

